import javax.swing.JComponent;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.Ellipse2D;

public class TrafficLightComponent extends JComponent
{
   public void paintComponent(Graphics g)
   {
      Graphics2D g2 = (Graphics2D) g;
      // your work here
      for(int j=0;j<high;j++){
      char ch=colors.charAt(j);
         Color c=getSquareColor(ch);
         g2.setColor(c);
         g2.fillRect(j*size,0,size,size);
  
   }
   }
}